Skip to content

Set keyAllocated=1 when initializing any key#1038

Merged
ejohnstown merged 2 commits into
wolfSSL:masterfrom
padelsbach:keyallocated-flag
Jun 22, 2026
Merged

Set keyAllocated=1 when initializing any key#1038
ejohnstown merged 2 commits into
wolfSSL:masterfrom
padelsbach:keyallocated-flag

Conversation

@padelsbach

@padelsbach padelsbach commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Fixes a possible memory leak if parsing fails. Only a problem with --enable-heapmath since normal spmath does not allocate buffers for the key.

Added unit tests and heapmath variant to CI.

Also, adding heapmath+asan uncovered a second unrelated leak when freeing the KEX key. Fix included as a second commit.

@padelsbach padelsbach marked this pull request as ready for review June 16, 2026 06:22
@padelsbach padelsbach requested a review from ejohnstown June 16, 2026 06:22

@ejohnstown ejohnstown left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore this comment.

Comment thread src/internal.c
Comment thread src/internal.c Outdated
@ejohnstown ejohnstown self-requested a review June 19, 2026 00:09
Comment thread compile_commands.json Outdated
Comment thread src/internal.c
@ejohnstown ejohnstown merged commit 52f6db9 into wolfSSL:master Jun 22, 2026
131 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants